﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS.Utilities;
using NS.BLL.Systems;
using Model;
using BLL;

public partial class Platform_CommuntyModify : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataShow();
        }
    }
    private void DataShow()
    {
        Communty Model = CommuntyService.GetCommuntyByCommuntyID(int.Parse(Request.QueryString["ID"].ToString()));
        if (Model != null)
        {
            txtCommuntyName.Text = Model.CommuntyName;
            Area.Value = Model.AreaNumber;
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Communty Model = CommuntyService.GetCommuntyByCommuntyID(int.Parse(Request.QueryString["ID"].ToString()));
        Model.CommuntyName = txtCommuntyName.Text.Trim();
        Model.AreaNumber = Area.Value;
        if (CommuntyService.UpdateCommuntyByCommuntyID(Model) > 0)
        {
            MessageBox.AppendScript(this, "$(':input[id$=\"btnBindData\"]', window.parent.document.body).click();");
        }
        else
        {
            MessageBox.ShowSaveError(this);
        }
    }
}